package mode.observer.jdk;

import java.util.Observable;

/**
 * @author xjx
 * @date 2023/7/27 14:54
 */
public class Subject extends Observable {

    //公众号的名字
    private String name;


    // 公众号发布消息
    public void notifyMessage(String message) {
        System.out.println(this.name + "公众号发布消息:" + message + "请关注用户留意接收!");
        super.setChanged();
        super.notifyObservers(message);
    }

    public Subject(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}
